<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <!-- 引用模板 Header -->
    <div th:insert="bg/publicHead :: publicHead"></div>
    <!-- [ Header ] end -->

    <style type="text/css">
        .contain{ width:800px; margin:0 auto;  }
        .contain .doctors{width:800px; margin:0 auto; overflow:hidden; }
        .contain .doctors .tables { margin-bottom:5px; display:flex; justify-content:flex-start; align-items:center; border-bottom:1px solid #f1f1f1;  }
        .contain .doctors .tables .text{ width:80px; }
        .contain .doctors .tables .input{ margin-left:10px; }
        .contain .doctors .tables .input input{ width:150px; }
        .contain h4{ margin:10px 0px; }
        .contain .doctors .tables .addBtn{ display:inline-block; width:100px; padding:5px; background: #0099ff; color:#FFF; text-align:center;
            cursor: pointer; }
    </style>
    <script src="/js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="/js/stroage.js" type="text/javascript" charset="UTF-8"></script>
    <script src="/js/comm.js" type="text/javascript" charset="UTF-8"></script>
    <script th:inline="javascript">
        window.onerror=function(){return true;};
        var ServerIP=[(${ServerIP!=null?'"'+ServerIP+'"':'"'+'"'})];
        $(document).ready(function() {
            $(".addBtn").click(async function(){
                //alert("添加医生账号");
                var doctorAccount=$(".docaccount").val();
                var docPwd=$(".docpwd").val();
                var uname=$(".uname").val();
                var usex=$(".usex").val();
                var uage=$(".uage").val();
                var dochospital=$(".dochospital").val();
                var docgoodat=$(".docgoodat").val();
                var docphone=$(".docphone").val();
                var docscore=$(".docscore").val();
                console.log("是否数字:"+/\d+/.test(docscore));
                if(/^\d+$/.test(docphone)===false){
                    alert("手机号码请输入数字");
                    return;
                }
                if(/^\d+$/.test(docscore)===false){
                    alert("评分请输入数字");
                    return;
                }
                //console.log(doctorAccount+","+docPwd);
                if (confirm("是否添加医生?")) {
                    //alert(dataid+","+cardAccount+","+cardPwd);
                    addData={
                        docaccount:doctorAccount,
                        docpwd:docPwd,
                        uname:uname,
                        usex:usex,
                        uage:uage,
                        dochospital:dochospital,
                        docgoodat:docgoodat,
                        docphone:docphone,
                        docscore:docscore
                    };
                    if(addData!=null){
                        var res=await SyncJson("/api/addDoctors",addData);
                        if(res.code===200){
                            alert("添加成功");
                        }
                    }
                }
            });
        });
    </script>
</head>


<body style="background:none;">
<!-- [ Main Content ] start -->
<div class="contain">
    <h4>添加医生账号</h4>
    <div class="doctors">
        <div class="tables">
            <div class="text">医生账号:</div>
            <div class="input"><input type="text" class="docaccount"></div>
        </div>
        <div class="tables">
            <div class="text">登录密码:</div>
            <div class="input"><input type="text" class="docpwd"></div>
        </div>
        <div class="tables">
            <div class="text">医生姓名:</div>
            <div class="input"><input type="text" class="uname"></div>
        </div>
        <div class="tables">
            <div class="text">性别:</div>
            <div class="input"><input type="text" class="usex"></div>
        </div>
        <div class="tables">
            <div class="text">年龄:</div>
            <div class="input"><input type="text" class="uage"></div>
        </div>
        <div class="tables">
            <div class="text">任职医院:</div>
            <div class="input"><input type="text" class="dochospital"></div>
        </div>
        <div class="tables">
            <div class="text">擅长:</div>
            <div class="input"><input type="text" class="docgoodat"></div>
        </div>
        <div class="tables">
            <div class="text">手机号码:</div>
            <div class="input"><input type="text" class="docphone"></div>
        </div>
        <div class="tables">
            <div class="text">评分:</div>
            <div class="input"><input type="text" class="docscore"></div>
        </div>
        <div class="tables" style="border-bottom:0px; margin-top:20px;">
            <div class="text"><a class="addBtn">添加</a></div>
            <div class="input"></div>
        </div>
    </div>
</div>
<!--中间 End -->
</body>



</html>